<?php
 /******************************************************************************
 *   GunCMS is an avid supporter of open source software. This is the appropriate 
 *   option if you are creating an open source application with a license 
 *   compatible with the GNU GPL license v3.
 *   For details http://www.gnu.org/licenses/gpl.html
 *   DO NOT USE FOR COMMERCIAL WITHOUT PERMISSION
 *
 * GunCMS Version 1.0.3
 * Copyright(c) 2009-2010, T & L GbR
 * info@guncms.de
 * 
 * http://www.guncms.de
 ********************************************************************************/
ob_start();
session_start();

	require_once("../configuration.php");
	require_once("../includes/db/constants.php");
	define(TEMPLATE_NAME,"admin");  ///// set template name to view admin templates 
	require_once("../includes/MySmarty.class.php");
	require_once("controller/BgcmsProcess.class.php");
	require_once("mustlogin.php");
	require_once("includes/util.php");
	
	include_once("controller/BgcmsAdminmenu.class.php");
	include_once("controller/BgcmsPaging.class.php");
	include_once("controller/BgcmsPage.class.php");
	include_once("controller/BgcmsCategory.class.php");
	include_once("controller/BgcmsConfigManager.class.php");
	include_once("controller/BgcmsUpload.class.php");
	include_once("controller/BgcmsNews.class.php");
	include_once("controller/BgcmsLogfiles.class.php");
	


	require_once("model/BgcmsOverviewBean.class.php");
	require_once("model/BgcmsUserBean.class.php");
	require_once("model/BgcmsPageBean.class.php");
	require_once("model/BgcmsCategoryBean.class.php");
	include_once("model/BgcmsConfigManagerBean.class.php");
	require_once("model/BgcmsNewsBean.class.php");
	require_once("model/BgcmsLogfilesBean.class.php");
	$allmenu = new BgcmsAdminmenu($db, $smarty);
	$allmenu->load_menu_top();
	$str1 = sprintf(_("Willkommen %s"), $_SESSION['user_name']);
	$str2 = _("Logout");
	$smarty->assign("username",$_SESSION['user_name']);
	$str3 = sprintf("%s <a href='./logout.php' class='link'>%s</a>", $str1, $str2);
	
	$smarty->assign("WELCOME_MSG", $str3);
	
	$option = "";
	if(isset($_GET["module"]))
		$option = $_GET["module"];
	
	if($option=="") {
		$option = "BgcmsOverview";
	}
	
	/**
	 * Show the main content
	 */
	
	if (file_exists("controller/$option.class.php")) {
		include_once("controller/$option.class.php");
		//we render html depend on parameter
		if($option != "") {
			//we use @ sign to ignore error and do not show any thing
			@($$option = new $option($db, $smarty));
			$$option->process();
		}
	}
	require_once("check_online.php");	
ob_end_flush();
?>